
package com.huarui.store.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.ewaf.framework.model.ListModel;
import org.ewaf.framework.service.BaseService;
import com.huarui.employee.dao.IEmployeeDao;
import com.huarui.store.action.StoreListModel;
import com.huarui.store.dao.IStoreDao;
import com.huarui.store.model.Store;

public class StoreService extends BaseService {
	@SuppressWarnings("unused")
	private IEmployeeDao iEmployeeDao;
	private IStoreDao getDao() {
		return (IStoreDao) dao;
	}

	@SuppressWarnings("unchecked")
	public List getStoreByCompanyId(Integer companyId) {
		return this.getDao().getStoreByCompanyId(companyId);
	}
	
	
	@SuppressWarnings("unchecked")
	public ListModel getStoresByConditions(StoreListModel lm,Integer companyId){
		Map map = new HashMap();
		map.put("companyId", companyId);
		map.put("isDelete", lm.getIsDelete());
		map.put("orderBy", lm.getOrderBy());
		map.put("start", lm.getStart());
		map.put("pageSize", lm.getPageSize());
		map.put("desc", lm.isDesc());
		Integer total=this.getDao().getByConditionsForCount(map);
		lm.setTotal(total);

		List result = this.getDao().getStoresByConditions(map);
		lm.setResult(result);
		return lm;
	}
	@SuppressWarnings("unchecked")
	public List findByComIdAndDepId(Map map){
		//iEmployeeDao.get

	 return	this.getDao().getAllStoresByConditions(map);
		
	}
	
	@SuppressWarnings("unchecked")
	public Store getByName(Map map){
		
		
		return getDao().getByName(map);
		
	}
	
}
